• Syntaxes:
      PROC <name>( [ <args> ] ) [ (<results>) ] IS <exp>
    
      PROC <name>( [ <args> ] ) [ (<results>) ]
        <statements>
      ENDPROC [ <exp> ]
    

    where <name> is the procedure name, <args> are arguments of the procedure and <results> are return value types. <exp> is a list of returning expressions. <statements> is all the code of the procedure.

  • Early exit (RETURN):
    Procedure can be left before the end is reached be the RETURN keyword. This also allows to return a list of values:
      RETURN [ <exp> ]
    

    where <exp> is a list of returning expressions.

  • Returning values:
    Procedures in PowerD can return one or more return values. All of these should be defined in <results> field (see above). Defaultly are all values typed as LONGs, so if the procedure return eg. FLOATs or DOUBLEs this field MUST be defined. If not, procedure will return bad values. (FLOATs and DOUBLEs are stored in floating point registers, while all others are stores in cpu data registers)
    All of these return types can contain also default return value and everywhere a procedure will be left without a return values these default will be used instead like here:
      PROC test()(DOUBLE,DOUBLE)
        RETURN 2,1.1
      ENDPROC 1.0,1.1
    

    is the same as:
      PROC test()(DOUBLE=1.0,DOUBLE=1.1)
        RETURN 2
      ENDPROC